package com.kyivmohyla.kma2.client.utils;

import java.util.Random;

public class PasswordGenerator {

    private static PasswordGenerator instance = new PasswordGenerator();

    public static PasswordGenerator getInstance() {
        if (instance == null) {
            instance = new PasswordGenerator();
        }
        return instance;
    }

    public String getGeneratedPassword() {
        String letters = "abcdefghijklmnopqrstuvwxyz123456789";
        Random random = new Random();
        String password = "";
        int passwordLen = 8 + (int) (Math.random() * ((13 - 8) + 1));
        for (int i = 0; i < passwordLen; i++)
            password += letters.charAt(random.nextInt(letters.length()));
        return password;

    }
}
